﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace List_of_All_databases
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string strServer = txtServer.Text.Trim();
            
            if (txtServer.Text == "")
            
            {
                strServer = "(local)";
            }

            System.Data.DataTable dt = new DataTable();

            clsReturnDBList cls = new clsReturnDBList();
            clsReturnSchema clsSchema = new clsReturnSchema();

            //dt = cls.dtDBList(strServer, txtLogin.Text, txtPassword.Text);
            try
            {
                dt = clsSchema.get_DBSchema(strServer, txtLogin.Text, txtPassword.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "TIMS");
            }
            //gridControl1.DataSource = dt;
            this.gridControl1.DataSource = dt;

            comboBox1.DataSource = dt;
            comboBox1.DisplayMember = "database_name";

        }
    }
}
